<?php
    require_once "config.php";
    if($_SERVER['REQUEST_METHOD'] == 'POST'){
        $params = array(
            'u_id'   => $_POST['u_id'],
            'web_id'   => $_POST['web_id'],
            'time'   => time(),
        );
        $sql = $mysql->query("select * from dyspw_report where u_id = {$params['u_id']} and web_id = {$params['web_id']}");
        $rows = $sql->fetch_all(MYSQLI_ASSOC);
        if(!empty($rows)){
            $result['status'] = 'n';
            $result['info'] = '你已举报此视频';
            exit(json_encode($result));
        }
        $follow_ins = $mysql->query("insert into dyspw_report (u_id,web_id,time) values ('{$params['u_id']}','{$params['web_id']}','{$params['time']}')");
        if(!empty($follow_ins)){
            $report_ins = $mysql->query("update dyspw_weblink set report = report + 1 where id ={$params['web_id']}");
            $result['status'] = 'y';
            $result['info'] = '举报成功，小八正在加紧处理';
            exit(json_encode($result));
        }
    }
 ?>
